package com.my.study.algorithm.linked;

/**
 * 一行代码反转字符串(采用递归)
 *
 * @author: yidujun
 * @create: 2021/04/12 19:44
 */
public class ReverseString {

    public static void main(String[] args) {
        String reverse = reverseString("Hollis is a Coder");
        System.out.println(reverse);
    }


    public static String reverseString(String sentense) {
        return sentense.isEmpty() ? sentense : reverseString(sentense.substring(1)) + sentense.charAt(0);
    }
}
